package jdbc.jdbc_Text;

import java.sql.*;


public class JDBC_ResultSet_Demo1 {
    public static void main(String[] args) throws ClassNotFoundException, SQLException {
        //注册驱动
        Class.forName("com.mysql.jdbc.Driver");
        //获取连接
        String url = "jdbc:mysql:///学生表";
        String user="root";
        String pswd="mysql";
        Connection connection = DriverManager.getConnection(url, user, pswd);
        //定义失去了语句
        String sql="insert into student(sno,sname,ssex) values ('004','陈真','女')";
        //执行获取失去了执行对象,
        Statement statement = connection.createStatement();
        //执行sql语句
        int i = statement.executeUpdate(sql);
        System.out.println(i);
        //释放资源
        statement.close();
        connection.close();
    }
}
